package com.kyin.satoken.service;

import cn.dev33.satoken.stp.SaTokenInfo;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.kyin.satoken.common.R;
import com.kyin.satoken.utils.CryptoUtil;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author yin.kai
 * @ClassName LoginService
 * @description: 类描述
 * @date 2025/9/23 17:03
 * @version: 1.0
 */
@Service
public class LoginService {


    public R login(Map<String, Object> params) {
        String username = MapUtil.getStr(params,"username");
        StpUtil.login(username);
        SaTokenInfo tokenInfo = StpUtil.getTokenInfo();
        return R.ok(tokenInfo.getTokenValue());
    }
}
